package com.treeste;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class HashMapDemo02 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        map.put("1号男的", "1号女的");
        map.put("2号男的", "2号女的");
        map.put("3号男的", "3号女的");
        map.put("4号男的", "4号女的");
        map.put("5号男的", "5号女的");
        Set<Map.Entry<String, String>> en = map.entrySet();
        for (Map.Entry<String, String> s : en) {
            String key = s.getKey();
            String value = s.getValue();
            System.out.println(key + "---" + value);
        }
        System.out.println("------------------");
        Iterator<Map.Entry<String, String>> iterator = en.iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, String> ss = iterator.next();
            String key1 = ss.getKey();
            String value1 = ss.getValue();
            System.out.println(key1 + "=" + value1);

        }


    }
}
